package com.dubbo.service.impl;

import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.dubbo.config.annotation.Service;
import com.dubbo.mapper.ArticleMapper;
import com.dubbo.service.Address2Service;
import com.dubbo.service.LoginService;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author chenluqiang
 * @date 2019/4/13
 */
@Service
@org.springframework.stereotype.Service
public class LoginServiceImpl implements LoginService{

    @Reference
    private Address2Service address2Service;
    @Resource
    private ArticleMapper articleMapper;

    @Override
    public boolean isLogin() {
       return false;
    }

    @Override
    public Map<String, Object> checkAddress() {
        Map<String,Object> map = new HashMap<>();
        List<Map<String, Object>> list = articleMapper.getArticleByType(1);
        map.put("list",list);
        if(address2Service !=null&& address2Service.isRightAddress()){
            map.put("code","200");
            map.put("msg","地址错误正确！");
        }else{
            map.put("code","502");
            map.put("msg","地址错误！");
        }

        return map;
    }

}
